--This script should be executed in the database having the SQLAgentJobReportFilters table.

set nocount on;


--declare variable(s)
declare @Environment as varchar(75)


--set variable(s)
set @Environment = 'UAT'


--xact_abort being on makes the entire transaction (below) behave as a single unit.  All SQL within the
--transaction will succeed (if no errors occur) or fail (if an error occurs) as a unit.
set xact_abort on


--wrap DML SQL within a transaction
begin tran


--remove all old group configuration settings
delete
from
  BIMonitor.SQLAgentJobReportFilters
where
  Environment = @Environment


--add new configuration settings
insert into BIMonitor.SQLAgentJobReportFilters
 (Environment,AttributeType,JobAttribute)
values
 (@Environment,
  'Category',
  'Report Server')


commit tran


--turn xact_abort off
set xact_abort off